home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / enemy / ShipBoss.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  21.4 KB  |  733 lines

  1. class classes.enemy.ShipBoss
  2. {
  3.    var x;
  4.    var y;
  5.    var color;
  6.    var moveScript;
  7.    var d;
  8.    var clip;
  9.    var lifeOrig;
  10.    var trans;
  11.    var colorTrans;
  12.    var dir;
  13.    var f2;
  14.    var axis;
  15.    var xDest;
  16.    var yDest;
  17.    var ep;
  18.    var laserCount;
  19.    var laserMax;
  20.    var oldDir;
  21.    var colorR;
  22.    var xMov = 0;
  23.    var yMov = 0;
  24.    var xMovT = 0;
  25.    var yMovT = 0;
  26.    var speedOrig = 12;
  27.    var speed = 12;
  28.    var xDestMet = false;
  29.    var yDestMet = false;
  30.    var c = 0;
  31.    var life = 100;
  32.    var nc = 0;
  33.    var xA = 0;
  34.    var yA = 0;
  35.    var nudging = false;
  36.    var power = 25;
  37.    var foreground = true;
  38.    var smoke = true;
  39.    var actionCount = 0;
  40.    var dOrange = 20;
  41.    var dPurple = 21;
  42.    var dGreen = 22;
  43.    var dRed = 23;
  44.    var moveScript1Orange = ["L",820,"U",1000,"break"];
  45.    var moveScript1Purple = ["R",450,"D",1000,"break"];
  46.    var moveScript1Green = ["L",190,"U",1000,"break"];
  47.    var moveScript1Red = ["L",190,"break"];
  48.    var Name = "shipBoss";
  49.    function ShipBoss(px, py, pcolor, pmoveScript)
  50.    {
  51.       this.x = px;
  52.       this.y = py;
  53.       this.color = pcolor;
  54.       this.moveScript = pmoveScript.slice();
  55.       _root.d = _root.d + 1;
  56.       this.d = _root.d + 190000;
  57.       this.clip = _root.attachMovie("shipBoss","shipBoss" + this.color + "Clip",this.d);
  58.       this.clip._x = this.x;
  59.       this.clip._y = this.y;
  60.       this.speed *= _root.dif.speed;
  61.       this.speedOrig = this.speed;
  62.       this.life *= _root.dif.life;
  63.       this.lifeOrig = this.life;
  64.       this.trans = new flash.geom.Transform(this.clip);
  65.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
  66.       this.clip.body.colors.gotoAndStop(this.color);
  67.       this.clip.body.flame1.gotoAndPlay("main");
  68.       this.clip.body.flame2.gotoAndPlay("main");
  69.       this.clip.swapDepths(this["d" + this.color]);
  70.       this.foreground = false;
  71.       this.smoke = false;
  72.       this.colorTrans.blueOffset = -255;
  73.       this.colorTrans.redOffset = -255;
  74.       this.colorTrans.greenOffset = -255;
  75.       this.trans.colorTransform = this.colorTrans;
  76.       this.clip._xscale = 66;
  77.       this.clip._yscale = 66;
  78.       this.speed *= 0.66;
  79.       this.parseMoveScript();
  80.       _root.shipBossCount = 3;
  81.       _root.boss = true;
  82.       if(this.color == "Green")
  83.       {
  84.          this.clip.body.windShield.gotoAndStop(2);
  85.       }
  86.       if(this.color == "Red")
  87.       {
  88.          this.clip.body.windShield.gotoAndStop(3);
  89.          this.life = 1000;
  90.          this.speed = 18;
  91.          this.speedOrig = 18;
  92.          this.speed *= _root.dif.speed;
  93.          this.speedOrig = this.speed;
  94.          this.life *= _root.dif.life;
  95.       }
  96.       _root.stats.created = _root.stats.created + 1;
  97.    }
  98.    function nudge(pxA, pyA, pscale)
  99.    {
  100.       this.nc = 0;
  101.       this.nudging = true;
  102.       var _loc2_ = pscale / 600;
  103.       this.xA = pxA * _loc2_;
  104.       this.yA = pyA * _loc2_;
  105.    }
  106.    function bombed(num)
  107.    {
  108.    }
  109.    function parseMoveScript()
  110.    {
  111.       var _loc2_ = this.dir;
  112.       this.dir = this.moveScript[0];
  113.       if(this.dir == "break")
  114.       {
  115.          delete this.moveScript;
  116.          this.f2 = "flying";
  117.          this.dir = _loc2_;
  118.       }
  119.       else
  120.       {
  121.          this[this.axis + "MovT"] = 0;
  122.          this.f2 = "gotoXYDest";
  123.          this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  124.          this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  125.          if(this.dir == "L" || this.dir == "U")
  126.          {
  127.             this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
  128.          }
  129.          else
  130.          {
  131.             this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
  132.          }
  133.          this.moveScript.splice(0,2);
  134.       }
  135.    }
  136.    function gotoXYDest()
  137.    {
  138.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  139.       {
  140.          if(this.axis == "x")
  141.          {
  142.             this.x = this.xDest;
  143.          }
  144.          else
  145.          {
  146.             this.y = this.yDest;
  147.          }
  148.          this.parseMoveScript();
  149.       }
  150.    }
  151.    function getDirString()
  152.    {
  153.       if(this.xMovT < -1)
  154.       {
  155.          this.dir = "L";
  156.       }
  157.       else if(this.xMovT > 1)
  158.       {
  159.          this.dir = "R";
  160.       }
  161.       else if(this.yMovT > 1)
  162.       {
  163.          this.dir = "D";
  164.       }
  165.       else if(this.yMovT < -1)
  166.       {
  167.          this.dir = "U";
  168.       }
  169.    }
  170.    function leaving()
  171.    {
  172.       this.xMovT * 1.04;
  173.    }
  174.    function blast(flameVar)
  175.    {
  176.       if(flameVar)
  177.       {
  178.          this.clip.body.flame1.gotoAndPlay("end");
  179.          this.clip.body.flame2.gotoAndPlay("end");
  180.       }
  181.       this.xMovT = 0;
  182.       this.yMovT = 0;
  183.       this.smoke = false;
  184.       this.clip.body.gotoAndPlay("fireStart");
  185.       this.clip.body.colors.clip.gotoAndPlay("fireStart");
  186.       this.f2 = "blasting";
  187.       this.c = 0;
  188.       _root.audio.playLevel2("shipBossBlast2",_root.randRange(45,65));
  189.    }
  190.    function blasting()
  191.    {
  192.       this.c = this.c + 1;
  193.       if(this.c == 6)
  194.       {
  195.          this.clip.body.charge.gotoAndPlay("go");
  196.       }
  197.       if(this.c == 30)
  198.       {
  199.          var _loc3_ = this.dir != "L" ? 39 : 9;
  200.          _root["shipBossBlast" + this.color] = new classes.shots.ShipBossBlast(this.x + _loc3_,this.y + 12,this.color,this.dir,this.color);
  201.          _root.addEnemyShot("shipBossBlast" + this.color);
  202.          var _loc4_ = this.dir != "L" ? -50 : 50;
  203.          this.nudge(_loc4_,0,100);
  204.       }
  205.    }
  206.    function closeTurrets()
  207.    {
  208.       this.clip.body.gotoAndPlay("fireEnd");
  209.       this.clip.body.colors.clip.gotoAndPlay("fireEnd");
  210.    }
  211.    function endBlast()
  212.    {
  213.       this.actionCount = this.actionCount + 1;
  214.       if(this.actionCount == 1)
  215.       {
  216.          this.fly(true);
  217.       }
  218.       else if(random(2) > 0)
  219.       {
  220.          this.strafe(false);
  221.       }
  222.       else
  223.       {
  224.          this.fly(true);
  225.       }
  226.    }
  227.    function fly(fly2)
  228.    {
  229.       if(fly2)
  230.       {
  231.          this.f2 = "flying2";
  232.       }
  233.       else
  234.       {
  235.          this.f2 = "flying";
  236.       }
  237.       this.smoke = true;
  238.       this.clip.body.flame1.gotoAndPlay("start");
  239.       this.clip.body.flame2.gotoAndPlay("start");
  240.       this[this.axis + "MovT"] = this.dir != "R" ? -1 * this.speed : this.speed;
  241.    }
  242.    function missleRun()
  243.    {
  244.       this.c = 0;
  245.       this.ep = _root.randRange(2,20);
  246.       this.f2 = "missleRunning";
  247.    }
  248.    function missleRunning()
  249.    {
  250.       this.c = this.c + 1;
  251.       if(this.c == this.ep)
  252.       {
  253.          if(this.dir == "U")
  254.          {
  255.             var _loc3_ = 3;
  256.             var _loc5_ = 24;
  257.             var _loc6_ = 30;
  258.             var _loc4_ = 24;
  259.          }
  260.          else
  261.          {
  262.             _loc3_ = 3;
  263.             _loc5_ = 3;
  264.             _loc6_ = 30;
  265.             _loc4_ = 3;
  266.          }
  267.          _root.enemyShotID = _root.enemyShotID + 1;
  268.          _root["shipBossMissle" + _root.enemyShotID] = new classes.shots.ShipBossMissle(this.x + _loc3_,this.y + _loc5_,this.color,this.dir,this.speed,_root.enemyShotID);
  269.          _root.addEnemyShot("shipBossMissle" + _root.enemyShotID);
  270.          _root.enemyShotID = _root.enemyShotID + 1;
  271.          _root["shipBossMissle" + _root.enemyShotID] = new classes.shots.ShipBossMissle(this.x + _loc6_,this.y + _loc4_,this.color,this.dir,this.speed,_root.enemyShotID);
  272.          _root.addEnemyShot("shipBossMissle" + _root.enemyShotID);
  273.          if(this.speed > 12)
  274.          {
  275.             this.c = 0;
  276.             this.ep = _root.randRange(7,20);
  277.          }
  278.          _root.audio.playLevel3("shipBossMissle2",_root.randRange(10,20));
  279.       }
  280.    }
  281.    function strafe(flameVar)
  282.    {
  283.       if(flameVar)
  284.       {
  285.          this.clip.body.flame1.gotoAndPlay("end");
  286.          this.clip.body.flame2.gotoAndPlay("end");
  287.       }
  288.       this.xMovT = 0;
  289.       this.c = 0;
  290.       this.ep = _root.randRange(30,300);
  291.       this.smoke = false;
  292.       this.yMovT = random(2) <= 0 ? this.speed * -0.215 : this.speed * 0.215;
  293.       this.f2 = "strafing";
  294.    }
  295.    function strafing()
  296.    {
  297.       this.c = this.c + 1;
  298.       if(random(200) > 198)
  299.       {
  300.          this.blast(false);
  301.       }
  302.       else if(random(100) > 97)
  303.       {
  304.          this.fireLaser();
  305.       }
  306.       if(this.y < 120)
  307.       {
  308.          this.yMovT = this.speed * 0.215;
  309.       }
  310.       if(this.y > 430)
  311.       {
  312.          this.yMovT = this.speed * -0.215;
  313.       }
  314.       if(this.c == this.ep)
  315.       {
  316.          this.yMovT = 0;
  317.          this.fly(true);
  318.       }
  319.    }
  320.    function fireLaser()
  321.    {
  322.       this.clip.body.gotoAndPlay("fireStart");
  323.       this.clip.body.colors.clip.gotoAndPlay("fireStart");
  324.       this.f2 = "firingLaser";
  325.       this.laserCount = 0;
  326.       this.laserMax = this.speed != 12 ? _root.randRange(2,5) : _root.randRange(1,3);
  327.       this.c = 0;
  328.    }
  329.    function firingLaser()
  330.    {
  331.       this.c = this.c + 1;
  332.       if(this.c == 15)
  333.       {
  334.          if(this.dir == "L")
  335.          {
  336.             var _loc3_ = -24;
  337.             var _loc9_ = -3;
  338.             var _loc10_ = -24;
  339.             var _loc8_ = 30;
  340.             var _loc7_ = -24;
  341.             var _loc5_ = -12;
  342.             var _loc6_ = -24;
  343.             var _loc4_ = 30;
  344.          }
  345.          else
  346.          {
  347.             _loc3_ = 45;
  348.             _loc9_ = -3;
  349.             _loc10_ = 45;
  350.             _loc8_ = 30;
  351.             _loc7_ = 45;
  352.             _loc5_ = -12;
  353.             _loc6_ = 45;
  354.             _loc4_ = 30;
  355.          }
  356.          _root.enemyShotID = _root.enemyShotID + 1;
  357.          _root["shipBossLaserA" + _root.enemyShotID] = new classes.shots.ShipBossLaserA(this.x + _loc3_,this.y + _loc9_,this.color,this.dir,this.speed,_root.enemyShotID);
  358.          _root.addEnemyShot("shipBossLaserA" + _root.enemyShotID);
  359.          _root.enemyShotID = _root.enemyShotID + 1;
  360.          _root["shipBossLaserA" + _root.enemyShotID] = new classes.shots.ShipBossLaserA(this.x + _loc10_,this.y + _loc8_,this.color,this.dir,this.speed,_root.enemyShotID);
  361.          _root.addEnemyShot("shipBossLaserA" + _root.enemyShotID);
  362.          _root.enemyShotID = _root.enemyShotID + 1;
  363.          _root["shipBossLaserB" + _root.enemyShotID] = new classes.shots.ShipBossLaserB(this.x + _loc7_,this.y + _loc5_,this.color,"U" + this.dir,this.speed,_root.enemyShotID);
  364.          _root.addEnemyShot("shipBossLaserB" + _root.enemyShotID);
  365.          _root.enemyShotID = _root.enemyShotID + 1;
  366.          _root["shipBossLaserB" + _root.enemyShotID] = new classes.shots.ShipBossLaserB(this.x + _loc6_,this.y + _loc4_,this.color,"D" + this.dir,this.speed,_root.enemyShotID);
  367.          _root.addEnemyShot("shipBossLaserB" + _root.enemyShotID);
  368.          _root.audio.playLevel3("shipBossLaser",_root.randRange(25,40));
  369.          this.c = 0;
  370.          this.laserCount = this.laserCount + 1;
  371.          if(this.laserCount == this.laserMax)
  372.          {
  373.             this.yMovT = 0;
  374.             this.closeTurrets();
  375.             this.c = 100;
  376.          }
  377.       }
  378.       if(this.c == 108)
  379.       {
  380.          this.yMovT = 0;
  381.          this.fly(true);
  382.       }
  383.       if(this.y < 120)
  384.       {
  385.          this.yMovT = this.speed * 0.215;
  386.       }
  387.       if(this.y > 430)
  388.       {
  389.          this.yMovT = this.speed * -0.215;
  390.       }
  391.    }
  392.    function flying()
  393.    {
  394.       if(this.foreground)
  395.       {
  396.          if(this.x < 850 && this.x > 100 && this.actionCount == 0)
  397.          {
  398.             this.blast(true);
  399.          }
  400.          else if(this.x < 870 && this.x > 80 && this.y > 80 && this.y < 470 && this.actionCount > 3)
  401.          {
  402.             if(this.axis == "x")
  403.             {
  404.                var _loc2_ = random(3);
  405.                if(_loc2_ == 0)
  406.                {
  407.                   this.blast(true);
  408.                }
  409.                else if(_loc2_ == 1)
  410.                {
  411.                   this.strafe(true);
  412.                }
  413.                else
  414.                {
  415.                   this.f2 = "";
  416.                }
  417.             }
  418.             else
  419.             {
  420.                this.missleRun();
  421.             }
  422.          }
  423.       }
  424.       else if(this.x < 1000 && this.x > 0 && this.actionCount == 2)
  425.       {
  426.          this.actionCount = this.actionCount + 1;
  427.          this.moveScript = this["moveScript1" + this.color];
  428.          this.parseMoveScript();
  429.       }
  430.       else if(random(100) > 96)
  431.       {
  432.          if(this.axis == "y" && this.y > 100 && this.y < 450 && this.actionCount > 3)
  433.          {
  434.             this.yMovT = 0;
  435.             this.axis = "x";
  436.             this.xMovT = random(2) <= 0 ? -1 * this.speed : this.speed;
  437.             this.getDirString();
  438.          }
  439.       }
  440.       else if(random(100) > 98)
  441.       {
  442.          if(this.axis == "x" && this.x < 850 && this.x > 100)
  443.          {
  444.             this.xMovT = 0;
  445.             this.axis = "y";
  446.             this.yMovT = random(2) <= 0 ? -1 * this.speed : this.speed;
  447.             this.getDirString();
  448.          }
  449.       }
  450.    }
  451.    function goBackground()
  452.    {
  453.       this.clip.swapDepths(this["d" + this.color]);
  454.       this.foreground = false;
  455.       this.smoke = false;
  456.       this.colorTrans.blueOffset = -255;
  457.       this.colorTrans.redOffset = -255;
  458.       this.colorTrans.greenOffset = -255;
  459.       this.trans.colorTransform = this.colorTrans;
  460.       this.clip._xscale = 66;
  461.       this.clip._yscale = 66;
  462.       this.speed *= 0.66;
  463.       this.xMovT *= 0.66;
  464.       this.yMovT *= 0.66;
  465.       this.reverseDir();
  466.       this.f2 = "flying";
  467.       this.actionCount = this.actionCount + 1;
  468.    }
  469.    function goForeground()
  470.    {
  471.       this.clip.swapDepths(this.d);
  472.       this.foreground = true;
  473.       this.smoke = true;
  474.       this.colorTrans.blueOffset = 0;
  475.       this.colorTrans.redOffset = 0;
  476.       this.colorTrans.greenOffset = 0;
  477.       this.trans.colorTransform = this.colorTrans;
  478.       this.clip._xscale = 100;
  479.       this.clip._yscale = 100;
  480.       this.speed = this.speedOrig;
  481.       this.xMovT /= 0.66;
  482.       this.yMovT /= 0.66;
  483.       this.reverseDir();
  484.       delete this.moveScript;
  485.       this.f2 = "flying";
  486.    }
  487.    function death()
  488.    {
  489.       _root.audio.playLevel2("shipBossX" + (random(3) + 1),_root.randRange(30,40));
  490.       _root.stats.destroyed = _root.stats.destroyed + 1;
  491.       _root.stats.score += 10000;
  492.       var _loc3_ = this.color;
  493.       if(_loc3_ == "Orange")
  494.       {
  495.          _loc3_ = "Red";
  496.       }
  497.       var _loc4_ = 0;
  498.       var _loc5_ = _root.randRange(5,8);
  499.       while(_loc4_ < _loc5_)
  500.       {
  501.          _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-50,50),this.y + this.clip._height / 2 + _root.randRange(-50,50),_root.randRange(80,150),_root.randRange(75,100),_loc3_]);
  502.          _loc4_ = _loc4_ + 1;
  503.       }
  504.       _loc4_ = 0;
  505.       _loc5_ = _root.randRange(6,10);
  506.       while(_loc4_ < _loc5_)
  507.       {
  508.          _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"shipBoss" + this.color,_loc3_,true]);
  509.          _loc4_ = _loc4_ + 1;
  510.       }
  511.       if(this.color != "Red")
  512.       {
  513.          _root.createPowerUp([this.x,this.y,"coin10"]);
  514.          _root.createPowerUp([this.x,this.y,"coin10"]);
  515.          _root.createPowerUp([this.x,this.y,"coin10"]);
  516.       }
  517.       else
  518.       {
  519.          _root.createPowerUp([this.x,this.y,"coin25"]);
  520.          _root.createPowerUp([this.x,this.y,"coin25"]);
  521.          _root.createPowerUp([this.x,this.y,"coin25"]);
  522.       }
  523.       if(this.color == "Orange")
  524.       {
  525.          _root.createPowerUp([this.x,this.y,"weaponBoost"]);
  526.       }
  527.       else if(this.color == "Green")
  528.       {
  529.          _root.createPowerUp([this.x,this.y,"speedBoost"]);
  530.       }
  531.       else if(this.color == "Purple")
  532.       {
  533.          _root.createPowerUp([this.x,this.y,"lifeUp"]);
  534.          _root.createPowerUp([this.x,this.y,"lifeUp"]);
  535.       }
  536.       else
  537.       {
  538.          _root.createPowerUp([this.x,this.y,"lifeUp"]);
  539.          _root.createPowerUp([this.x,this.y,"lifeUp"]);
  540.          _root.createPowerUp([this.x,this.y,"shield"]);
  541.       }
  542.       _root.shipBossOrange.speed += 3;
  543.       _root.shipBossGreen.speed += 3;
  544.       _root.shipBossPurple.speed += 3;
  545.       _root.shipBossOrange.speedOrig += 3;
  546.       _root.shipBossGreen.speedOrig += 3;
  547.       _root.shipBossPurple.speedOrig += 3;
  548.       _root.shipBossCount = _root.shipBossCount - 1;
  549.       if(_root.shipBossCount == 0)
  550.       {
  551.          delete _root.shipBossCount;
  552.          _root.boss = false;
  553.          _root.initLevel2();
  554.       }
  555.       if(this.color == "Red")
  556.       {
  557.          _root.removeRandoms([1]);
  558.          _root.boss = false;
  559.       }
  560.       _root.removeChar("shipBoss" + this.color);
  561.    }
  562.    function death2()
  563.    {
  564.       _root.removeChar("shipBoss" + this.color);
  565.    }
  566.    function reverseDir()
  567.    {
  568.       if(this.dir == "L")
  569.       {
  570.          this.dir = "R";
  571.          this.xMovT = this.speed;
  572.          this.yMovT = 0;
  573.          this.x += 150;
  574.       }
  575.       else if(this.dir == "R")
  576.       {
  577.          this.dir = "L";
  578.          this.xMovT = -1 * this.speed;
  579.          this.yMovT = 0;
  580.          this.x -= 150;
  581.       }
  582.       else if(this.dir == "U")
  583.       {
  584.          this.dir = "D";
  585.          this.xMovT = 0;
  586.          this.yMovT = this.speed;
  587.          this.y += 150;
  588.       }
  589.       else if(this.dir == "D")
  590.       {
  591.          this.dir = "U";
  592.          this.xMovT = 0;
  593.          this.yMovT = -1 * this.speed;
  594.          this.y -= 150;
  595.       }
  596.    }
  597.    function main()
  598.    {
  599.       this[this.f2]();
  600.       if(this.oldDir != this.dir)
  601.       {
  602.          this.clip.gotoAndStop(this.dir);
  603.       }
  604.       this.oldDir = this.dir;
  605.       if(this.foreground)
  606.       {
  607.          if(this.nudging)
  608.          {
  609.             this.xA *= 0.7;
  610.             this.yA *= 0.7;
  611.             this.nc = this.nc + 1;
  612.             var _loc8_ = 255 - this.nc * 17;
  613.             this.colorTrans.redOffset = _loc8_;
  614.             this.trans.colorTransform = this.colorTrans;
  615.             if(this.nc == 15)
  616.             {
  617.                this.xA = this.yA = 0;
  618.                this.nudging = false;
  619.                this.colorTrans.blueOffset = this.colorR;
  620.                this.colorTrans.greenOffset = this.colorR;
  621.                this.colorTrans.redOffset = this.colorR;
  622.                this.trans.colorTransform = this.colorTrans;
  623.             }
  624.          }
  625.          var _loc4_ = 0;
  626.          var _loc7_ = _root.broShots.length;
  627.          while(_loc4_ < _loc7_)
  628.          {
  629.             var _loc6_ = _root.broShots[_loc4_] + "Clip";
  630.             if(this.clip.hitTest(_root[_loc6_]))
  631.             {
  632.                if(this.x < 950 && this.x > 0 && this.y > 0 && this.y < 550)
  633.                {
  634.                   var _loc3_ = _root.broShots[_loc4_];
  635.                   var _loc5_ = this.life;
  636.                   this.life -= _root[_loc3_].power;
  637.                   this.clip.body.d1.gotoAndStop(Math.ceil((100 - this.life / this.lifeOrig * 100) / 20));
  638.                   this.clip.body.d2.gotoAndStop(Math.ceil((100 - this.life / this.lifeOrig * 100) / 20));
  639.                   this.clip.body.d3.gotoAndStop(Math.ceil((100 - this.life / this.lifeOrig * 100) / 20));
  640.                   if(this.life < 1)
  641.                   {
  642.                      this.f2 = "death";
  643.                   }
  644.                   else
  645.                   {
  646.                      this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,10);
  647.                      _root.audio.playLevel4("shipBossHit" + (random(3) + 1),_root.randRange(15,25));
  648.                   }
  649.                   _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
  650.                   _root[_loc3_].exploX = this.x + this.clip._width / 2;
  651.                   _root[_loc3_].exploY = this.y + this.clip._height / 2;
  652.                   _root[_loc3_].hit(_loc5_);
  653.                }
  654.             }
  655.             _loc4_ = _loc4_ + 1;
  656.          }
  657.          if(this.clip.hitTest(_root[_root.char + "Clip"]))
  658.          {
  659.             _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  660.             this.nudge(_root.randRange(-6,6),_root.randRange(-6,6),100);
  661.          }
  662.       }
  663.       if(this.smoke)
  664.       {
  665.          if(random(10) > 6)
  666.          {
  667.             if(this.dir == "L")
  668.             {
  669.                var _loc10_ = this.x + 51;
  670.                var _loc9_ = this.y + _root.randRange(12,27);
  671.             }
  672.             else if(this.dir == "R")
  673.             {
  674.                _loc10_ = this.x + -6;
  675.                _loc9_ = this.y + _root.randRange(12,27);
  676.             }
  677.             else if(this.dir == "U")
  678.             {
  679.                _loc10_ = this.x + _root.randRange(12,27);
  680.                _loc9_ = this.y + 48;
  681.             }
  682.             else
  683.             {
  684.                _loc10_ = this.x + _root.randRange(12,27);
  685.                _loc9_ = this.y + -6;
  686.             }
  687.             _root.shrapID = _root.shrapID + 1;
  688.             _root["shipSmoke" + _root.shrapID] = new classes.fx.ShipSmoke(_loc10_,_loc9_,_root.shrapID);
  689.             _root.addFX("shipSmoke" + _root.shrapID);
  690.          }
  691.       }
  692.       if(this.x > 1200 || this.x < -200 || this.y < -200 || this.y > 800)
  693.       {
  694.          if(this.foreground)
  695.          {
  696.             this.goBackground();
  697.          }
  698.          else
  699.          {
  700.             this.goForeground();
  701.          }
  702.       }
  703.       if(this.xMovT < this.xMov)
  704.       {
  705.          this.xMov -= 2;
  706.       }
  707.       else if(this.xMovT > this.xMov)
  708.       {
  709.          this.xMov += 2;
  710.       }
  711.       else
  712.       {
  713.          this.xMov = this.xMovT;
  714.       }
  715.       if(this.yMovT < this.yMov)
  716.       {
  717.          this.yMov -= 2;
  718.       }
  719.       else if(this.yMovT > this.yMov)
  720.       {
  721.          this.yMov += 2;
  722.       }
  723.       else
  724.       {
  725.          this.yMov = this.yMovT;
  726.       }
  727.       this.x += this.xMov + this.xA;
  728.       this.y += this.yMov + this.yA;
  729.       this.clip._x = this.x;
  730.       this.clip._y = this.y;
  731.    }
  732. }
  733.